
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>Blocks &#8212; Block diagram simulation 0.7 documentation</title>
    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/language_data.js"></script>
    <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="bdsim package" href="bdsim.html" />
   
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="blocks">
<h1>Blocks<a class="headerlink" href="#blocks" title="Permalink to this headline">¶</a></h1>
<p>The block diagrams comprise blocks which belong to one of a number of different categories. These come from
the package <code class="docutils literal notranslate"><span class="pre">bdsim.blocks</span></code>.</p>
<div class="graphviz"><img src="_images/inheritance-b73e4c5fc66d274cb80ffb7499bb974eef646de5.png" alt="Inheritance diagram of bdsim.components.SourceBlock, bdsim.components.SinkBlock, bdsim.components.GraphicsBlock, bdsim.components.FunctionBlock, bdsim.components.TransferBlock, bdsim.components.SubsystemBlock" usemap="#inheritance2fdfb15a6a" class="inheritance graphviz" /></div>
<map id="inheritance2fdfb15a6a" name="inheritance2fdfb15a6a">
<area shape="rect" id="node1" href="bdsim.html#bdsim.components.Block" target="_top" title="Construct a new block object." alt="" coords="5,104,176,129"/>
<area shape="rect" id="node2" href="bdsim.html#bdsim.components.FunctionBlock" target="_top" title="A FunctionBlock is a subclass of Block that represents a block that has inputs" alt="" coords="231,5,453,31"/>
<area shape="rect" id="node4" href="bdsim.html#bdsim.components.SinkBlock" target="_top" title="A SinkBlock is a subclass of Block that represents a block that has inputs" alt="" coords="244,55,440,80"/>
<area shape="rect" id="node5" href="bdsim.html#bdsim.components.SourceBlock" target="_top" title="A SourceBlock is a subclass of Block that represents a block that has outputs" alt="" coords="236,104,448,129"/>
<area shape="rect" id="node6" href="bdsim.html#bdsim.components.SubsystemBlock" target="_top" title="A Function is a subclass of Block that represents a block that has inputs" alt="" coords="224,153,460,179"/>
<area shape="rect" id="node7" href="bdsim.html#bdsim.components.TransferBlock" target="_top" title="A TransferBlock is a subclass of Block that represents a block with inputs" alt="" coords="232,203,452,228"/>
<area shape="rect" id="node3" href="bdsim.html#bdsim.components.GraphicsBlock" target="_top" title="A GraphicsBlock is a subclass of SinkBlock that represents a block that has inputs" alt="" coords="508,55,732,80"/>
</map><div class="section" id="module-bdsim.blocks.sources">
<span id="source-blocks"></span><h2>Source blocks<a class="headerlink" href="#module-bdsim.blocks.sources" title="Permalink to this headline">¶</a></h2>
<p>Source blocks:</p>
<ul class="simple">
<li><p>have outputs but no inputs</p></li>
<li><p>have no state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">SourceBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code></p></li>
</ul>
<dl class="class">
<dt id="bdsim.blocks.sources.Constant">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sources.</code><code class="sig-name descname">Constant</code><span class="sig-paren">(</span><em class="sig-param">value=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#Constant"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.Constant" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SourceBlock" title="bdsim.components.SourceBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SourceBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">CONSTANT</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td></td>
<td><p>float,
A(N,)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sources.Constant.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">value=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#Constant.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.Constant.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>any</em>) – the constant, defaults to None</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a CONSTANT block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Constant instance</p>
</dd>
</dl>
<p>Create a constant block.</p>
<p>This block has only one output port, but the value can be any 
Python type, so long as the connected input port can handle it.
For example float, list or numpy ndarray.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sources.Piecewise">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sources.</code><code class="sig-name descname">Piecewise</code><span class="sig-paren">(</span><em class="sig-param">*seq</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#Piecewise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.Piecewise" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SourceBlock" title="bdsim.components.SourceBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SourceBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">PIECEWISE</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sources.Piecewise.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*seq</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#Piecewise.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.Piecewise.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*seq</strong> (<em>list of 2-tuples</em>) – Sequence of time, value pairs</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a PIECEWISE block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Piecewise instance</p>
</dd>
</dl>
<p>Create a piecewise constant signal block.</p>
<p>Outputs a piecewise constant function of time.  This is described as
a series of 2-tupes (time, value).  The output value is taken from the
active tuple, that is, the latest one in the list whose time is no greater
than simulation time.</p>
<p>Note that there is no default initial value, the list should contain
a tuple with time zero otherwise the output will be undefined.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sources.Step">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sources.</code><code class="sig-name descname">Step</code><span class="sig-paren">(</span><em class="sig-param">T=1</em>, <em class="sig-param">off=0</em>, <em class="sig-param">on=1</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#Step"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.Step" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SourceBlock" title="bdsim.components.SourceBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SourceBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">STEP</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sources.Step.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">T=1</em>, <em class="sig-param">off=0</em>, <em class="sig-param">on=1</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#Step.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.Step.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>T</strong> (<em>float</em><em>, </em><em>optional</em>) – time of step, defaults to 1</p></li>
<li><p><strong>off</strong> (<em>float</em><em>, </em><em>optional</em>) – initial value, defaults to 0</p></li>
<li><p><strong>on</strong> (<em>float</em><em>, </em><em>optional</em>) – final value, defaults to 1</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a STEP block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#bdsim.blocks.sources.Step" title="bdsim.blocks.sources.Step">Step</a></p>
</dd>
</dl>
<p>Create a step signal block.</p>
<p>Output a step signal that transitions from the value <code class="docutils literal notranslate"><span class="pre">off</span></code> to <code class="docutils literal notranslate"><span class="pre">on</span></code>
when time equals <code class="docutils literal notranslate"><span class="pre">T</span></code>.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sources.WaveForm">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sources.</code><code class="sig-name descname">WaveForm</code><span class="sig-paren">(</span><em class="sig-param">wave='square'</em>, <em class="sig-param">freq=1</em>, <em class="sig-param">unit='Hz'</em>, <em class="sig-param">phase=0</em>, <em class="sig-param">amplitude=1</em>, <em class="sig-param">offset=0</em>, <em class="sig-param">min=None</em>, <em class="sig-param">max=None</em>, <em class="sig-param">duty=0.5</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#WaveForm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.WaveForm" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SourceBlock" title="bdsim.components.SourceBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SourceBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">WAVEFORM</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sources.WaveForm.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">wave='square'</em>, <em class="sig-param">freq=1</em>, <em class="sig-param">unit='Hz'</em>, <em class="sig-param">phase=0</em>, <em class="sig-param">amplitude=1</em>, <em class="sig-param">offset=0</em>, <em class="sig-param">min=None</em>, <em class="sig-param">max=None</em>, <em class="sig-param">duty=0.5</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sources.html#WaveForm.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sources.WaveForm.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>wave</strong> (<em>str</em><em>, </em><em>optional</em>) – type of waveform to generate: ‘sine’, ‘square’ [default], ‘triangle’</p></li>
<li><p><strong>freq</strong> (<em>float</em><em>, </em><em>optional</em>) – frequency, defaults to 1</p></li>
<li><p><strong>unit</strong> (<em>str</em><em>, </em><em>optional</em>) – frequency unit, can be ‘rad/s’, defaults to ‘Hz’</p></li>
<li><p><strong>amplitude</strong> (<em>float</em><em>, </em><em>optional</em>) – amplitude, defaults to 1</p></li>
<li><p><strong>offset</strong> (<em>float</em><em>, </em><em>optional</em>) – signal offset, defaults to 0</p></li>
<li><p><strong>phase</strong> (<em>float</em><em>, </em><em>optional</em>) – Initial phase of signal in the range [0,1], defaults to 0</p></li>
<li><p><strong>min</strong> (<em>float</em><em>, </em><em>optional</em>) – minimum value, defaults to 0</p></li>
<li><p><strong>max</strong> (<em>float</em><em>, </em><em>optional</em>) – maximum value, defaults to 1</p></li>
<li><p><strong>duty</strong> (<em>float</em><em>, </em><em>optional</em>) – duty cycle for square wave in range [0,1], defaults to 0.5</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a WAVEFORM block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>WaveForm instance</p>
</dd>
</dl>
<p>Create a waveform generator block.</p>
<p>Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">WAVEFORM</span><span class="p">(</span><span class="n">wave</span><span class="o">=</span><span class="s1">&#39;sine&#39;</span><span class="p">,</span> <span class="n">freq</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>   <span class="c1"># 2Hz sine wave varying from -1 to 1</span>
<span class="n">WAVEFORM</span><span class="p">(</span><span class="n">wave</span><span class="o">=</span><span class="s1">&#39;square&#39;</span><span class="p">,</span> <span class="n">freq</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="s1">&#39;rad/s&#39;</span><span class="p">)</span> <span class="c1"># 2rad/s square wave varying from -1 to 1</span>
</pre></div>
</div>
<p>The minimum and maximum values of the waveform are given by default in
terms of amplitude and offset. The signals are symmetric about the offset 
value. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">WAVEFORM</span><span class="p">(</span><span class="n">wave</span><span class="o">=</span><span class="s1">&#39;sine&#39;</span><span class="p">)</span> <span class="n">varies</span> <span class="n">between</span> <span class="o">-</span><span class="mi">1</span> <span class="ow">and</span> <span class="o">+</span><span class="mi">1</span>
<span class="n">WAVEFORM</span><span class="p">(</span><span class="n">wave</span><span class="o">=</span><span class="s1">&#39;sine&#39;</span><span class="p">,</span> <span class="n">amplitude</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> <span class="n">varies</span> <span class="n">between</span> <span class="o">-</span><span class="mi">2</span> <span class="ow">and</span> <span class="o">+</span><span class="mi">2</span>
<span class="n">WAVEFORM</span><span class="p">(</span><span class="n">wave</span><span class="o">=</span><span class="s1">&#39;sine&#39;</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">varies</span> <span class="n">between</span> <span class="mi">0</span> <span class="ow">and</span> <span class="o">+</span><span class="mi">2</span>
<span class="n">WAVEFORM</span><span class="p">(</span><span class="n">wave</span><span class="o">=</span><span class="s1">&#39;sine&#39;</span><span class="p">,</span> <span class="n">amplitude</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">varies</span> <span class="n">between</span> <span class="o">-</span><span class="mi">1</span> <span class="ow">and</span> <span class="o">+</span><span class="mi">3</span>
</pre></div>
</div>
<p>Alternatively we can specify the minimum and maximum values which override
amplitude and offset:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">WAVEFORM</span><span class="p">(</span><span class="n">wave</span><span class="o">=</span><span class="s1">&#39;triangle&#39;</span><span class="p">,</span> <span class="nb">min</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="nb">max</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> <span class="n">varies</span> <span class="n">between</span> <span class="mi">0</span> <span class="ow">and</span> <span class="o">+</span><span class="mi">5</span>
</pre></div>
</div>
<p>At time 0 the sine and triangle wave are zero and increasing, and the
square wave has its first rise.  We can specify a phase shift with 
a number in the range [0,1] where 1 corresponds to one cycle.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-bdsim.blocks.sinks">
<span id="sink-blocks"></span><h2>Sink blocks<a class="headerlink" href="#module-bdsim.blocks.sinks" title="Permalink to this headline">¶</a></h2>
<p>Sink blocks:</p>
<ul class="simple">
<li><p>have inputs but no outputs</p></li>
<li><p>have no state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">SinkBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code></p></li>
<li><p>that perform graphics are a subclass of  <code class="docutils literal notranslate"><span class="pre">GraphicsBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">SinkBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code></p></li>
</ul>
<dl class="class">
<dt id="bdsim.blocks.sinks.MultiRotorPlot">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sinks.</code><code class="sig-name descname">MultiRotorPlot</code><span class="sig-paren">(</span><em class="sig-param">model, *inputs, scale=[-2, 2, -2, 2, 10], flapscale=1, projection='ortho', **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#MultiRotorPlot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.MultiRotorPlot" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.GraphicsBlock" title="bdsim.components.GraphicsBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.GraphicsBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">MULTIROTORPLOT</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>dict</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sinks.MultiRotorPlot.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">model, *inputs, scale=[-2, 2, -2, 2, 10], flapscale=1, projection='ortho', **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#MultiRotorPlot.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.MultiRotorPlot.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>model</strong> (<em>dict</em>) – A dictionary of vehicle geometric and inertial properties</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>scale</strong> (<em>array_like</em>) – dimensions of workspace: xmin, xmax, ymin, ymax, zmin, zmax</p></li>
<li><p><strong>flapscale</strong> (<em>float</em>) – exagerate flapping angle by this factor, default is 1</p></li>
<li><p><strong>projection</strong> (<em>str</em>) – 3D projection: ortho or perspective, defaults to ‘ortho’</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a MULTIROTOPLOT block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>MultiRobotPlot instance</p>
</dd>
</dl>
<p>Create a block that displays/animates a multi-rotor flying vehicle.</p>
<div class="figure align-default" id="id1">
<a class="reference internal image-reference" href="_images/multirotorplot.png"><img alt="example of generated graphic" src="_images/multirotorplot.png" style="width: 500px;" /></a>
<p class="caption"><span class="caption-text">Example of quad-rotor display.</span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</div>
<p>Written by Pauline Pounds 2004</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sinks.Print">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sinks.</code><code class="sig-name descname">Print</code><span class="sig-paren">(</span><em class="sig-param">fmt=None</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#Print"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.Print" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SinkBlock" title="bdsim.components.SinkBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SinkBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">PRINT</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>any</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sinks.Print.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">fmt=None</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#Print.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.Print.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fmt</strong> (<em>str</em><em>, </em><em>optional</em>) – Format string, defaults to None</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A PRINT block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Print instance</p>
</dd>
</dl>
<p>Create a console print block which displays the value of a signal to the console
at each simulation time step.</p>
<p>The numerical formatting of the signal is controlled by <code class="docutils literal notranslate"><span class="pre">fmt</span></code>:</p>
<ul class="simple">
<li><p>if not provided, <code class="docutils literal notranslate"><span class="pre">str()</span></code> is used to format the signal</p></li>
<li><dl class="simple">
<dt>if provided:</dt><dd><ul>
<li><p>a scalar is formatted by the <code class="docutils literal notranslate"><span class="pre">fmt.format()</span></code></p></li>
<li><p>a numpy array is formatted by <code class="docutils literal notranslate"><span class="pre">fmt.format()</span></code> applied to every element</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sinks.Scope">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sinks.</code><code class="sig-name descname">Scope</code><span class="sig-paren">(</span><em class="sig-param">nin=None</em>, <em class="sig-param">styles=None</em>, <em class="sig-param">scale='auto'</em>, <em class="sig-param">labels=None</em>, <em class="sig-param">grid=True</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#Scope"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.Scope" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.GraphicsBlock" title="bdsim.components.GraphicsBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.GraphicsBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">SCOPE</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(N,)</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sinks.Scope.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">nin=None</em>, <em class="sig-param">styles=None</em>, <em class="sig-param">scale='auto'</em>, <em class="sig-param">labels=None</em>, <em class="sig-param">grid=True</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#Scope.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.Scope.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a block that plots input ports against time.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nin</strong> (<em>int</em><em>, </em><em>optional</em>) – number of inputs, defaults to length of style vector if given,
otherwise 1</p></li>
<li><p><strong>styles</strong> (<em>optional str</em><em> or </em><em>dict</em><em>, </em><em>list of strings</em><em> or </em><em>dicts; one per line</em>) – styles for each line to be plotted</p></li>
<li><p><strong>scale</strong> (<em>2-element sequence</em>) – y-axis scale, defaults to ‘auto’</p></li>
<li><p><strong>labels</strong> (<em>sequence of strings</em>) – vertical axis labels</p></li>
<li><p><strong>grid</strong> (<em>bool</em><em> or </em><em>sequence</em>) – draw a grid, default is on. Can be boolean or a tuple of 
options for grid()</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A SCOPE block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Scope instance</p>
</dd>
</dl>
<p>Create a block that plots input ports against time.</p>
<p>Each line can have its own color or style which is specified by:</p>
<blockquote>
<div><ul class="simple">
<li><p>a dict of options for <a class="reference external" href="https://matplotlib.org/3.2.2/api/_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D">Line2D</a> or</p></li>
<li><p>a  MATLAB-style linestyle like ‘k–’</p></li>
</ul>
</div></blockquote>
<p>If multiple lines are plotted then a heterogeneous list of styles, dicts or strings,
one per line must be given.</p>
<p>The vertical scale factor defaults to auto-scaling but can be fixed by
providing a 2-tuple [ymin, ymax]. All lines are plotted against the
same vertical scale.</p>
<p>Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">SCOPE</span><span class="p">()</span>
<span class="n">SCOPE</span><span class="p">(</span><span class="n">nin</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
<span class="n">SCOPE</span><span class="p">(</span><span class="n">nin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span>
<span class="n">SCOPE</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;k&#39;</span><span class="p">,</span> <span class="s1">&#39;r--&#39;</span><span class="p">])</span>
<span class="n">SCOPE</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="s1">&#39;k--&#39;</span><span class="p">)</span>
<span class="n">SCOPE</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;color:&#39;</span><span class="p">,</span> <span class="s1">&#39;red, &#39;</span><span class="n">linestyle</span><span class="s1">&#39;: &#39;</span><span class="o">--</span><span class="s1">&#39;&#39;</span><span class="p">})</span>
</pre></div>
</div>
<div class="figure align-default" id="id2">
<a class="reference internal image-reference" href="_images/Figure_1.png"><img alt="example of generated graphic" src="_images/Figure_1.png" style="width: 500px;" /></a>
<p class="caption"><span class="caption-text">Example of scope display.</span><a class="headerlink" href="#id2" title="Permalink to this image">¶</a></p>
</div>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sinks.ScopeXY">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sinks.</code><code class="sig-name descname">ScopeXY</code><span class="sig-paren">(</span><em class="sig-param">style=None, *inputs, scale='auto', labels=['X', 'Y'], init=None, **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#ScopeXY"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.ScopeXY" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.GraphicsBlock" title="bdsim.components.GraphicsBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.GraphicsBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">SCOPEXY</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>2</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sinks.ScopeXY.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">style=None, *inputs, scale='auto', labels=['X', 'Y'], init=None, **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#ScopeXY.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.ScopeXY.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>style</strong> (<em>optional str</em><em> or </em><em>dict</em>) – line style</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>scale</strong> (<em>2-</em><em> or </em><em>4-element sequence</em>) – y-axis scale, defaults to ‘auto’</p></li>
<li><p><strong>labels</strong> (<em>2-element tuple</em><em> or </em><em>list</em>) – axis labels (xlabel, ylabel)</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A SCOPEXY block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>ScopeXY instance</p>
</dd>
</dl>
<p>Create an XY scope.</p>
<p>This block has two inputs which are plotted against each other. Port 0
is the horizontal axis, and port 1 is the vertical axis.</p>
<p>The line style is given by either:</p>
<blockquote>
<div><ul class="simple">
<li><p>a dict of options for <code class="docutils literal notranslate"><span class="pre">plot</span></code>, or</p></li>
<li><p>as a simple MATLAB-style linestyle like <code class="docutils literal notranslate"><span class="pre">'k--'</span></code>.</p></li>
</ul>
</div></blockquote>
<p>The scale factor defaults to auto-scaling but can be fixed by
providing either:</p>
<blockquote>
<div><ul class="simple">
<li><p>a 2-tuple [min, max] which is used for the x- and y-axes</p></li>
<li><p>a 4-tuple [xmin, xmax, ymin, ymax]</p></li>
</ul>
</div></blockquote>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sinks.Stop">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sinks.</code><code class="sig-name descname">Stop</code><span class="sig-paren">(</span><em class="sig-param">stop</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#Stop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.Stop" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SinkBlock" title="bdsim.components.SinkBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SinkBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">STOP</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>any</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sinks.Stop.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">stop</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#Stop.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.Stop.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>stop</strong> (<em>TYPE</em>) – Function</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A STOP block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Stop instance</p>
</dd>
</dl>
<p>Conditionally stop the simulation.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.sinks.VehiclePlot">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.sinks.</code><code class="sig-name descname">VehiclePlot</code><span class="sig-paren">(</span><em class="sig-param">*inputs, path=True, pathstyle=None, shape='triangle', color='blue', fill='white', size=1, scale='auto', labels=['X', 'Y'], square=True, init=None, **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#VehiclePlot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.VehiclePlot" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.GraphicsBlock" title="bdsim.components.GraphicsBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.GraphicsBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">VEHICLEPLOT</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 31%" />
<col style="width: 35%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>3</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.sinks.VehiclePlot.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs, path=True, pathstyle=None, shape='triangle', color='blue', fill='white', size=1, scale='auto', labels=['X', 'Y'], square=True, init=None, **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/sinks.html#VehiclePlot.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.sinks.VehiclePlot.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>path</strong> (<em>bool</em><em>, </em><em>optional</em>) – plot path taken by vehicle, defaults to True</p></li>
<li><p><strong>pathstyle</strong> (<em>str</em><em> or </em><em>dict</em><em>, </em><em>optional</em>) – linestyle for path, defaults to None</p></li>
<li><p><strong>shape</strong> (<em>str</em><em>, </em><em>optional</em>) – vehicle shape: ‘triangle’ (default) or ‘box’</p></li>
<li><p><strong>color</strong> (<em>str</em><em>, </em><em>optional</em>) – vehicle outline color, defaults to “blue”</p></li>
<li><p><strong>fill</strong> (<em>str</em><em>, </em><em>optional</em>) – vehicle fill color, defaults to “white”</p></li>
<li><p><strong>size</strong> (<em>float</em><em>, </em><em>optional</em>) – length of vehicle, defaults to 1</p></li>
<li><p><strong>scale</strong> (<em>2-</em><em> or </em><em>4-element sequence</em>) – x- and y-axis scale, defaults to ‘auto’</p></li>
<li><p><strong>labels</strong> (<em>2-element tuple</em><em> or </em><em>list</em>) – axis labels (xlabel, ylabel)</p></li>
<li><p><strong>square</strong> (<em>bool</em><em>, </em><em>optional</em>) – Set aspect ratio to 1, defaults to True</p></li>
<li><p><strong>init</strong> (<em>callable</em><em>, </em><em>optional</em>) – initialize graphics, defaults to None</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A VEHICLEPLOT block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>VehiclePlot instance</p>
</dd>
</dl>
<p>Create a vehicle animation similar to the figure below.</p>
<p>Notes:</p>
<blockquote>
<div><ul class="simple">
<li><p>The <code class="docutils literal notranslate"><span class="pre">init</span></code> function is called after the axes are initialized
and can be used to draw application specific detail on the
plot. In the example below, this is the dot and star.</p></li>
<li><p>A dynamic trail, showing path to date can be animated if
the option <code class="docutils literal notranslate"><span class="pre">path</span></code> is True.</p></li>
<li><p>Two shapes of vehicle can be drawn, a narrow triangle and a box
(as seen below).</p></li>
</ul>
</div></blockquote>
<div class="figure align-default" id="id3">
<a class="reference internal image-reference" href="_images/rvc4_4.gif"><img alt="example of generated graphic" src="_images/rvc4_4.gif" style="width: 500px;" /></a>
<p class="caption"><span class="caption-text">Example of vehicle display (animated).  The label at the top is the
block name.</span><a class="headerlink" href="#id3" title="Permalink to this image">¶</a></p>
</div>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-bdsim.blocks.functions">
<span id="function-blocks"></span><h2>Function blocks<a class="headerlink" href="#module-bdsim.blocks.functions" title="Permalink to this headline">¶</a></h2>
<p>Function blocks:</p>
<ul class="simple">
<li><p>have inputs and outputs</p></li>
<li><p>have no state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">FunctionBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code></p></li>
</ul>
<dl class="class">
<dt id="bdsim.blocks.functions.Clip">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.functions.</code><code class="sig-name descname">Clip</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">min=-inf</em>, <em class="sig-param">max=inf</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Clip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Clip" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">CLIP</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(N,)</p></td>
<td><p>float,
A(N,)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.functions.Clip.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">min=-inf</em>, <em class="sig-param">max=inf</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Clip.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Clip.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>min</strong> (<em>float</em><em> or </em><em>array_like</em><em>, </em><em>optional</em>) – Minimum value, defaults to -math.inf</p></li>
<li><p><strong>max</strong> (<em>float</em><em> or </em><em>array_like</em><em>, </em><em>optional</em>) – Maximum value, defaults to math.inf</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A CLIP block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Clip instance</p>
</dd>
</dl>
<p>Create a value clipping block.</p>
<p>Input signals are clipped to the range from <code class="docutils literal notranslate"><span class="pre">minimum</span></code> to <code class="docutils literal notranslate"><span class="pre">maximum</span></code> inclusive.</p>
<p>The signal can be a vector in which case each element is clipped.  The
minimum and maximum values can be:</p>
<blockquote>
<div><ul class="simple">
<li><p>a scalar, in which case the same value applies to every element of 
the input vector , or</p></li>
<li><p>a vector, of the same shape as the input vector that applies elementwise to
the input vector.</p></li>
</ul>
</div></blockquote>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.functions.Function">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.functions.</code><code class="sig-name descname">Function</code><span class="sig-paren">(</span><em class="sig-param">func</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">nin=1</em>, <em class="sig-param">nout=1</em>, <em class="sig-param">dict=False</em>, <em class="sig-param">args=()</em>, <em class="sig-param">kwargs={}</em>, <em class="sig-param">**kwargs_</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Function"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Function" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">FUNCTION</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>nin</p></td>
<td><p>nout</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>any</p></td>
<td><p>any</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.functions.Function.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">func</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">nin=1</em>, <em class="sig-param">nout=1</em>, <em class="sig-param">dict=False</em>, <em class="sig-param">args=()</em>, <em class="sig-param">kwargs={}</em>, <em class="sig-param">**kwargs_</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Function.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Function.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> (<em>callable</em><em> or </em><em>sequence of callables</em>) – A function or lambda, or list thereof</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>nin</strong> (<em>int</em><em>, </em><em>optional</em>) – number of inputs, defaults to 1</p></li>
<li><p><strong>nout</strong> (<em>int</em><em>, </em><em>optional</em>) – number of outputs, defaults to 1</p></li>
<li><p><strong>dict</strong> (<em>bool</em>) – pass in a reference to a dictionary instance</p></li>
<li><p><strong>args</strong> (<em>tuple</em><em>, </em><em>optional</em>) – extra positional arguments passed to the function, defaults to ()</p></li>
<li><p><strong>kwargs</strong> (<em>dict</em><em>, </em><em>optional</em>) – extra keyword arguments passed to the function, defaults to {}</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A FUNCTION block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>_Function</p>
</dd>
</dl>
<p>Create a Python function block.</p>
<p>A block with one output port that sums its two input ports is:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">FUNCTION</span><span class="p">(</span><span class="k">lambda</span> <span class="n">u1</span><span class="p">,</span> <span class="n">u2</span><span class="p">:</span> <span class="n">u1</span><span class="o">+</span><span class="n">u2</span><span class="p">,</span> <span class="n">nin</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
</pre></div>
</div>
<p>A block with a function that takes two inputs and has two additional arguments:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">myfun</span><span class="p">(</span><span class="n">u1</span><span class="p">,</span> <span class="n">u2</span><span class="p">,</span> <span class="n">param1</span><span class="p">,</span> <span class="n">param2</span><span class="p">):</span>
    <span class="k">pass</span>

<span class="n">FUNCTION</span><span class="p">(</span><span class="n">myfun</span><span class="p">,</span> <span class="n">nin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span><span class="n">p2</span><span class="p">))</span>
</pre></div>
</div>
<p>If we need access to persistent (static) data, to keep some state:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">myfun</span><span class="p">(</span><span class="n">u1</span><span class="p">,</span> <span class="n">u2</span><span class="p">,</span> <span class="n">param1</span><span class="p">,</span> <span class="n">param2</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
    <span class="k">pass</span>

<span class="n">FUNCTION</span><span class="p">(</span><span class="n">myfun</span><span class="p">,</span> <span class="n">nin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span><span class="n">p2</span><span class="p">),</span> <span class="nb">dict</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<p>where a dictionary is passed in as the last argument which is kept from call to call.</p>
<p>A block with a function that takes two inputs and additional keyword arguments:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">myfun</span><span class="p">(</span><span class="n">u1</span><span class="p">,</span> <span class="n">u2</span><span class="p">,</span> <span class="n">param1</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">param2</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">param3</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">param4</span><span class="o">=</span><span class="mi">4</span><span class="p">):</span>
    <span class="k">pass</span>

<span class="n">FUNCTION</span><span class="p">(</span><span class="n">myfun</span><span class="p">,</span> <span class="n">nin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">kwargs</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;param2&#39;</span><span class="p">:</span><span class="mi">7</span><span class="p">,</span> <span class="s1">&#39;param3&#39;</span><span class="p">:</span><span class="mi">8</span><span class="p">})</span>
</pre></div>
</div>
<p>A block with two inputs and two outputs, the outputs are defined by two lambda
functions with the same inputs:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">FUNCTION</span><span class="p">(</span> <span class="p">[</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x_t</span><span class="p">,</span> <span class="n">lanbda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span><span class="o">*</span> <span class="n">y</span><span class="p">])</span>
</pre></div>
</div>
<p>A block with two inputs and two outputs, the outputs are defined by a 
single function:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">myfun</span><span class="p">(</span><span class="n">u1</span><span class="p">,</span> <span class="n">u2</span><span class="p">):</span>
    <span class="k">return</span> <span class="p">[</span> <span class="n">u1</span><span class="o">+</span><span class="n">u2</span><span class="p">,</span> <span class="n">u1</span><span class="o">*</span><span class="n">u2</span> <span class="p">]</span>

<span class="n">FUNCTION</span><span class="p">(</span> <span class="n">myfun</span><span class="p">,</span> <span class="n">nin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">nout</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.functions.Gain">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.functions.</code><code class="sig-name descname">Gain</code><span class="sig-paren">(</span><em class="sig-param">gain</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">premul=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Gain"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Gain" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">GAIN</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(N,),
A(N,M)</p></td>
<td><p>float,
A(N,),
A(N,M)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.functions.Gain.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">gain</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">premul=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Gain.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Gain.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>gain</strong> (<em>float</em>) – The gain value</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>premul</strong> (<em>bool</em><em>, </em><em>optional</em>) – premultiply by constant, default is postmultiply</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A GAIN block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Gain instance</p>
</dd>
</dl>
<p>Create a gain block.</p>
<p>This block has only one input and one output port. The output is the
product of the input by the gain.</p>
<p>Either or both the input and gain can be numpy arrays and numpy will
compute the appropriate product.  If both are numpy arrays then the
matmult operator <cite>&#64;</cite> is used and by default the input is postmultiplied
by the gain, but this can be changed using the <code class="docutils literal notranslate"><span class="pre">premul</span></code> option.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.functions.Interpolate">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.functions.</code><code class="sig-name descname">Interpolate</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x=None</em>, <em class="sig-param">y=None</em>, <em class="sig-param">xy=None</em>, <em class="sig-param">time=False</em>, <em class="sig-param">kind='linear'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Interpolate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Interpolate" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">INTERPOLATE</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>0 or 1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float</p></td>
<td><p>any</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.functions.Interpolate.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x=None</em>, <em class="sig-param">y=None</em>, <em class="sig-param">xy=None</em>, <em class="sig-param">time=False</em>, <em class="sig-param">kind='linear'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Interpolate.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Interpolate.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>x</strong> (<em>array_like</em><em>, </em><em>shape</em><em> (</em><em>N</em><em>,</em><em>) </em><em>optional</em>) – x-values of function</p></li>
<li><p><strong>y</strong> (<em>array_like</em><em>, </em><em>optional</em>) – y-values of function</p></li>
<li><p><strong>xy</strong> (<em>array_like</em><em>, </em><em>optional</em>) – combined x- and y-values of function</p></li>
<li><p><strong>time</strong> (<em>bool</em>) – x new is simulation time, defaults to False</p></li>
<li><p><strong>kind</strong> (<em>str</em>) – interpolation method, defaults to ‘linear’</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>INTERPOLATE block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>_Function</p>
</dd>
</dl>
<p>Create an interpolation block.</p>
<p>A block that interpolates its input according to a piecewise function.</p>
<p>A simple triangle function with domain [0,10] and range [0,1] can be
defined by:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">INTERPOLATE</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">10</span><span class="p">),</span> <span class="n">y</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">))</span>
</pre></div>
</div>
<p>We might also express this as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">INTERPOLATE</span><span class="p">(</span><span class="n">xy</span><span class="o">=</span><span class="p">[(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">0</span><span class="p">)])</span>
</pre></div>
</div>
<p>The data can also be expressed as numpy arrays.  If that is the case,
the interpolation function can be vector valued. <code class="docutils literal notranslate"><span class="pre">x</span></code> has a shape of
(N,1) and <code class="docutils literal notranslate"><span class="pre">y</span></code> has a shape of (N,M).  Alternatively <code class="docutils literal notranslate"><span class="pre">xy</span></code> has a shape
of (N,M+1) and the first column is the x-data.</p>
<p>The input to the interpolator comes from:</p>
<ul class="simple">
<li><p>Input port 0</p></li>
<li><p>Simulation time, if <code class="docutils literal notranslate"><span class="pre">time=True</span></code>.  In this case the block has no
input ports and is a <code class="docutils literal notranslate"><span class="pre">Source</span></code> not a <code class="docutils literal notranslate"><span class="pre">Function</span></code>.</p></li>
</ul>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.functions.Prod">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.functions.</code><code class="sig-name descname">Prod</code><span class="sig-paren">(</span><em class="sig-param">ops</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">matrix=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Prod"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Prod" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">PROD</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>len(ops)</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(N,),
A(N,M)</p></td>
<td><p>float,
A(N,),
A(N,M)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.functions.Prod.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">ops</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">matrix=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Prod.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Prod.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ops</strong> (<em>str</em>) – operations associated with input ports * or /</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>matrix</strong> (<em>bool</em>) – Arguments are matrices, use &#64; and np.linalg.inv, default False</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A PROD block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Prod instance</p>
</dd>
</dl>
<p>Create a product junction.</p>
<p>The number of input ports is determined by the length of the <cite>ops</cite>
string.  For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">PROD</span><span class="p">(</span><span class="s1">&#39;*/*&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>is a 3-input product junction where ports 0 and 2 are multiplied and
port 1 is divided.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.functions.Sum">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.functions.</code><code class="sig-name descname">Sum</code><span class="sig-paren">(</span><em class="sig-param">signs</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">angles=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Sum"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Sum" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">SUM</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>len(signs)</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(N,),
A(N,M)</p></td>
<td><p>float,
A(N,),
A(N,M)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.functions.Sum.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">signs</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">angles=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/functions.html#Sum.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.functions.Sum.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>signs</strong> (<em>str</em>) – signs associated with input ports, + or -</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>angles</strong> (<em>bool</em>) – the signals are angles, wrap to [-pi,pi)</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A SUM block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Sum instance</p>
</dd>
</dl>
<p>Create a summing junction.</p>
<p>The number of input ports is determined by the length of the <cite>signs</cite>
string.  For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">SUM</span><span class="p">(</span><span class="s1">&#39;+-+&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>is a 3-input summing junction where ports 0 and 2 are added and
port 1 is subtracted.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-bdsim.blocks.transfers">
<span id="transfer-blocks"></span><h2>Transfer blocks<a class="headerlink" href="#module-bdsim.blocks.transfers" title="Permalink to this headline">¶</a></h2>
<p>Transfer blocks:</p>
<ul class="simple">
<li><p>have inputs and outputs</p></li>
<li><p>have state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">TransferBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code></p></li>
</ul>
<dl class="class">
<dt id="bdsim.blocks.transfers.Integrator">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.transfers.</code><code class="sig-name descname">Integrator</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x0=0</em>, <em class="sig-param">min=None</em>, <em class="sig-param">max=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/transfers.html#Integrator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.transfers.Integrator" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.TransferBlock" title="bdsim.components.TransferBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.TransferBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">INTEGRATOR</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>N</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(N,)</p></td>
<td><p>float,
A(N,)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.transfers.Integrator.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x0=0</em>, <em class="sig-param">min=None</em>, <em class="sig-param">max=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/transfers.html#Integrator.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.transfers.Integrator.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>x0</strong> (<em>array_like</em><em>, </em><em>optional</em>) – Initial state, defaults to 0</p></li>
<li><p><strong>min</strong> (<em>float</em><em> or </em><em>array_like</em><em>, </em><em>optional</em>) – Minimum value of state, defaults to None</p></li>
<li><p><strong>max</strong> (<em>float</em><em> or </em><em>array_like</em><em>, </em><em>optional</em>) – Maximum value of state, defaults to None</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>an INTEGRATOR block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Integrator instance</p>
</dd>
</dl>
<p>Create an integrator block.</p>
<p>Output is the time integral of the input.  The state can be a scalar or a
vector, this is given by the type of <code class="docutils literal notranslate"><span class="pre">x0</span></code>.</p>
<p>The minimum and maximum values can be:</p>
<blockquote>
<div><ul class="simple">
<li><p>a scalar, in which case the same value applies to every element of 
the state vector, or</p></li>
<li><p>a vector, of the same shape as <code class="docutils literal notranslate"><span class="pre">x0</span></code> that applies elementwise to
the state.</p></li>
</ul>
</div></blockquote>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.transfers.LTI_SISO">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.transfers.</code><code class="sig-name descname">LTI_SISO</code><span class="sig-paren">(</span><em class="sig-param">N=1, D=[1, 1], *inputs, x0=None, verbose=False, **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/transfers.html#LTI_SISO"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.transfers.LTI_SISO" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#bdsim.blocks.transfers.LTI_SS" title="bdsim.blocks.transfers.LTI_SS"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.blocks.transfers.LTI_SS</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">LTI_SISO</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>n</p></td>
</tr>
<tr class="row-odd"><td><p>float</p></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.transfers.LTI_SISO.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">N=1, D=[1, 1], *inputs, x0=None, verbose=False, **kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/transfers.html#LTI_SISO.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.transfers.LTI_SISO.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>N</strong> (<em>array_like</em><em>, </em><em>optional</em>) – numerator coefficients, defaults to 1</p></li>
<li><p><strong>D</strong> (<em>array_like</em><em>, </em><em>optional</em>) – denominator coefficients, defaults to [1, 1]</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>x0</strong> (<em>array_like</em><em>, </em><em>optional</em>) – initial states, defaults to zero</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A SCOPE block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>LTI_SISO instance</p>
</dd>
</dl>
<p>Create a SISO LTI block.</p>
<p>Describes the dynamics of a single-input single-output (SISO) linear
time invariant (LTI) system described by numerator and denominator
polynomial coefficients.</p>
<p>Coefficients are given in the order from highest order to zeroth 
order, ie. <span class="math notranslate nohighlight">\(2s^2 - 4s +3\)</span> is <code class="docutils literal notranslate"><span class="pre">[2,</span> <span class="pre">-4,</span> <span class="pre">3]</span></code>.</p>
<p>Only proper transfer functions, where order of numerator is less
than denominator are allowed.</p>
<p>The order of the states in <code class="docutils literal notranslate"><span class="pre">x0</span></code> is consistent with controller canonical
form.</p>
<p>Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">LTI_SISO</span><span class="p">(</span><span class="n">N</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">D</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="o">-</span><span class="mi">4</span><span class="p">])</span>
</pre></div>
</div>
<p>is the transfer function <span class="math notranslate nohighlight">\(\frac{s+2}{2s^2+3s-4}\)</span>.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.transfers.LTI_SS">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.transfers.</code><code class="sig-name descname">LTI_SS</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">A=None</em>, <em class="sig-param">B=None</em>, <em class="sig-param">C=None</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">verbose=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/transfers.html#LTI_SS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.transfers.LTI_SS" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.TransferBlock" title="bdsim.components.TransferBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.TransferBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">LTI_SS</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>01</p></td>
<td><p>nc</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(nb,)</p></td>
<td><p>float,
A(nc,)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.transfers.LTI_SS.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">A=None</em>, <em class="sig-param">B=None</em>, <em class="sig-param">C=None</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">verbose=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/transfers.html#LTI_SS.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.transfers.LTI_SS.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>N</strong> (<em>array_like</em><em>, </em><em>optional</em>) – numerator coefficients, defaults to 1</p></li>
<li><p><strong>D</strong> (<em>array_like</em><em>, </em><em>optional</em>) – denominator coefficients, defaults to [1, 1]</p></li>
<li><p><strong>x0</strong> (<em>array_like</em><em>, </em><em>optional</em>) – initial states, defaults to zero</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A SCOPE block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>LTI_SISO instance</p>
</dd>
</dl>
<p>Create a state-space LTI block.</p>
<p>Describes the dynamics of a single-input single-output (SISO) linear
time invariant (LTI) system described by numerator and denominator
polynomial coefficients.</p>
<p>Coefficients are given in the order from highest order to zeroth 
order, ie. <span class="math notranslate nohighlight">\(2s^2 - 4s +3\)</span> is <code class="docutils literal notranslate"><span class="pre">[2,</span> <span class="pre">-4,</span> <span class="pre">3]</span></code>.</p>
<p>Only proper transfer functions, where order of numerator is less
than denominator are allowed.</p>
<p>The order of the states in <code class="docutils literal notranslate"><span class="pre">x0</span></code> is consistent with controller canonical
form.</p>
<p>Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">LTI_SISO</span><span class="p">(</span><span class="n">N</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">],</span> <span class="n">D</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="o">-</span><span class="mi">4</span><span class="p">])</span>
</pre></div>
</div>
<p>is the transfer function <span class="math notranslate nohighlight">\(\frac{s+2}{2s^2+3s-4}\)</span>.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-bdsim.blocks.robots">
<span id="robot-blocks"></span><h2>Robot blocks<a class="headerlink" href="#module-bdsim.blocks.robots" title="Permalink to this headline">¶</a></h2>
<p>Robot blocks:
- have inputs and outputs
- are a subclass of <code class="docutils literal notranslate"><span class="pre">FunctionBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code> for kinematics and have no states
- are a subclass of <code class="docutils literal notranslate"><span class="pre">TransferBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code> for dynamics and have states</p>
<dl class="class">
<dt id="bdsim.blocks.robots.Bicycle">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.robots.</code><code class="sig-name descname">Bicycle</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">L=1</em>, <em class="sig-param">vlim=1</em>, <em class="sig-param">slim=1</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#Bicycle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.Bicycle" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.TransferBlock" title="bdsim.components.TransferBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.TransferBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">BICYCLE</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>2</p></td>
<td><p>3</p></td>
<td><p>3</p></td>
</tr>
<tr class="row-odd"><td><p>float</p></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.robots.Bicycle.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">L=1</em>, <em class="sig-param">vlim=1</em>, <em class="sig-param">slim=1</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#Bicycle.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.Bicycle.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>x0</strong> (<em>array_like</em><em>, </em><em>optional</em>) – Inital state, defaults to 0</p></li>
<li><p><strong>L</strong> (<em>float</em><em>, </em><em>optional</em>) – Wheelbase, defaults to 1</p></li>
<li><p><strong>vlim</strong> (<em>float</em><em>, </em><em>optional</em>) – Velocity limit, defaults to 1</p></li>
<li><p><strong>slim</strong> (<em>float</em><em>, </em><em>optional</em>) – Steering limit, defaults to 1</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a BICYCLE block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Bicycle instance</p>
</dd>
</dl>
<p>Create a vehicle model with Bicycle kinematics.</p>
<p>Bicycle kinematic model with state <span class="math notranslate nohighlight">\([x, y,        heta]\)</span>.</p>
<p>The block has two input ports:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Vehicle speed (metres/sec).  The velocity limit <code class="docutils literal notranslate"><span class="pre">vlim</span></code> is
applied to the magnitude of this input.</p></li>
<li><p>Steering wheel angle (radians).  The steering limit <code class="docutils literal notranslate"><span class="pre">slim</span></code>
is applied to the magnitude of this input.</p></li>
</ol>
</div></blockquote>
<p>and three output ports:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>x position in the world frame (metres)</p></li>
<li><p>y positon in the world frame (metres)</p></li>
<li><p>heading angle with respect to the world frame (radians)</p></li>
</ol>
</div></blockquote>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.robots.DiffSteer">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.robots.</code><code class="sig-name descname">DiffSteer</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">R=1</em>, <em class="sig-param">W=1</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#DiffSteer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.DiffSteer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.TransferBlock" title="bdsim.components.TransferBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.TransferBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">DIFFSTEER</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>2</p></td>
<td><p>3</p></td>
<td><p>3</p></td>
</tr>
<tr class="row-odd"><td><p>float</p></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.robots.DiffSteer.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">R=1</em>, <em class="sig-param">W=1</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#DiffSteer.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.DiffSteer.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>x0</strong> (<em>array_like</em><em>, </em><em>optional</em>) – Inital state, defaults to 0</p></li>
<li><p><strong>R</strong> (<em>float</em><em>, </em><em>optional</em>) – Wheel radius, defaults to 1</p></li>
<li><p><strong>W</strong> – Wheel separation in lateral direction, defaults to 1</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a DIFFSTEER block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>DifSteer instance</p>
</dd>
</dl>
<p>Create a differential steer vehicle model with Unicycle kinematics, with inputs
given as wheel angular velocity.</p>
<p>Unicycle kinematic model with state <span class="math notranslate nohighlight">\([x, y, \theta]\)</span>.</p>
<p>The block has two input ports:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Left-wheel angular velocity (radians/sec).</p></li>
<li><p>Right-wheel angular velocity (radians/sec).</p></li>
</ol>
</div></blockquote>
<p>and three output ports:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>x position in the world frame (metres)</p></li>
<li><p>y positon in the world frame (metres)</p></li>
<li><p>heading angle with respect to the world frame (radians)</p></li>
</ol>
</div></blockquote>
<p>Note:</p>
<blockquote>
<div><ul class="simple">
<li><p>wheel velocity is defined such that if both are positive the vehicle
moves forward.</p></li>
</ul>
</div></blockquote>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.robots.MultiRotor">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.robots.</code><code class="sig-name descname">MultiRotor</code><span class="sig-paren">(</span><em class="sig-param">model</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">groundcheck=True</em>, <em class="sig-param">speedcheck=True</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#MultiRotor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.MultiRotor" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.TransferBlock" title="bdsim.components.TransferBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.TransferBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">MULTIROTOR</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>16</p></td>
</tr>
<tr class="row-odd"><td><p>A(4,)</p></td>
<td><p>dict</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.robots.MultiRotor.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">model</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">groundcheck=True</em>, <em class="sig-param">speedcheck=True</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#MultiRotor.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.MultiRotor.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>model</strong> (<em>dict</em>) – Vehicle geometric and inertial parameters</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>groundcheck</strong> (<em>bool</em>) – Prevent vehicle moving below ground , defaults to True</p></li>
<li><p><strong>speedcheck</strong> (<em>bool</em>) – Check for zero rotor speed, defaults to True</p></li>
<li><p><strong>x0</strong> (<em>TYPE</em><em>, </em><em>optional</em>) – Initial state, defaults to all zeros</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a MULTIROTOR block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>MultiRotor instance</p>
</dd>
</dl>
<p>Create a a multi-rotor dynamic model block.</p>
<p>The block has one input port which is a vector of input rotor speeds
in (radians/sec).  These are, looking down, clockwise from the front rotor
which lies on the x-axis.</p>
<p>The block has one output port which is a dictionary signal with the
following items:</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">x</span></code> pose in the world frame as <span class="math notranslate nohighlight">\([x, y, z, \theta_Y, \theta_P, \theta_R]\)</span></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">vb</span></code> translational velocity in the world frame (metres/sec)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">w</span></code> angular rates in the world frame as yaw-pitch-roll rates (radians/second)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">a1s</span></code> longitudinal flapping angles (radians)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">b1s</span></code> lateral flapping angles (radians)</p></li>
</ul>
</div></blockquote>
<p>Based on MATLAB code developed by Pauline Pounds 2004.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.robots.Unicycle">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.robots.</code><code class="sig-name descname">Unicycle</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#Unicycle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.Unicycle" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.TransferBlock" title="bdsim.components.TransferBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.TransferBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">UNICYCLE</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>2</p></td>
<td><p>3</p></td>
<td><p>3</p></td>
</tr>
<tr class="row-odd"><td><p>float</p></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.robots.Unicycle.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*inputs</em>, <em class="sig-param">x0=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/robots.html#Unicycle.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.robots.Unicycle.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>x0</strong> (<em>array_like</em><em>, </em><em>optional</em>) – Inital state, defaults to 0</p></li>
<li><p><strong>*inputs</strong> – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a UNICYCLE block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Unicycle instance</p>
</dd>
</dl>
<p>Create a vehicle model with Unicycle kinematics.</p>
<p>Unicycle kinematic model with state <span class="math notranslate nohighlight">\([x, y, \theta]\)</span>.</p>
<p>The block has two input ports:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Vehicle speed (metres/sec).</p></li>
<li><p>Angular velocity (radians/sec).</p></li>
</ol>
</div></blockquote>
<p>and three output ports:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>x position in the world frame (metres)</p></li>
<li><p>y positon in the world frame (metres)</p></li>
<li><p>heading angle with respect to the world frame (radians)</p></li>
</ol>
</div></blockquote>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-bdsim.blocks.connections">
<span id="connection-blocks"></span><h2>Connection blocks<a class="headerlink" href="#module-bdsim.blocks.connections" title="Permalink to this headline">¶</a></h2>
<p>Connection blocks are in two categories:</p>
<ol class="arabic simple">
<li><dl class="simple">
<dt>Signal manipulation:</dt><dd><ul class="simple">
<li><p>have inputs and outputs</p></li>
<li><p>have no state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">FunctionBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code></p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>Subsystem support</dt><dd><ul class="simple">
<li><p>have inputs or outputs</p></li>
<li><p>have no state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">SubsysytemBlock</span></code> → <code class="docutils literal notranslate"><span class="pre">Block</span></code></p></li>
</ul>
</dd>
</dl>
</li>
</ol>
<dl class="class">
<dt id="bdsim.blocks.connections.DeMux">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.connections.</code><code class="sig-name descname">DeMux</code><span class="sig-paren">(</span><em class="sig-param">nout=1</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#DeMux"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.DeMux" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">DEMUX</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>nout</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(nout,)</p></td>
<td><p>float</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.connections.DeMux.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">nout=1</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#DeMux.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.DeMux.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nout</strong> (<em>TYPE</em><em>, </em><em>optional</em>) – DESCRIPTION, defaults to 1</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A DEMUX block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>DeMux instance</p>
</dd>
</dl>
<p>Create a demultiplexer block.</p>
<p>This block has a single input port and <code class="docutils literal notranslate"><span class="pre">nout</span></code> output ports.  A vector
input signal (with <code class="docutils literal notranslate"><span class="pre">nout</span></code> elements) is routed element-wise to individual
scalar output port.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.connections.InPort">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.connections.</code><code class="sig-name descname">InPort</code><span class="sig-paren">(</span><em class="sig-param">nout=1</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#InPort"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.InPort" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SubsystemBlock" title="bdsim.components.SubsystemBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SubsystemBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">INPORT</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>0</p></td>
<td><p>nout</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td></td>
<td><p>any</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.connections.InPort.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">nout=1</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#InPort.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.InPort.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nout</strong> (<em>int</em><em>, </em><em>optional</em>) – Number of output ports, defaults to 1</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An INPORT block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>InPort instance</p>
</dd>
</dl>
<p>Create an input port block for a subsystem.</p>
<p>This block connects a subsystem to a parent block diagram.  Inputs to the
parent-level <code class="docutils literal notranslate"><span class="pre">SubSystem</span></code> block appear as outputs of this block.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.connections.Item">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.connections.</code><code class="sig-name descname">Item</code><span class="sig-paren">(</span><em class="sig-param">item</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#Item"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.Item" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">ITEM</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>dict</p></td>
<td><p>any</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.connections.Item.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">item</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#Item.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.Item.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>item</strong> (<em>str</em>) – name of dictionary item</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An ITEM block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Item instance</p>
</dd>
</dl>
<p>Create a signal selector block.</p>
<p>For a dictionary type inut signal select one item as the output signal.
For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ITEM</span><span class="p">(</span><span class="s1">&#39;xd&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>selects the <code class="docutils literal notranslate"><span class="pre">xd</span></code> item from the dictionary output signal of the MULTIROTOR
block.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.connections.Mux">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.connections.</code><code class="sig-name descname">Mux</code><span class="sig-paren">(</span><em class="sig-param">nin=1</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#Mux"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.Mux" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.FunctionBlock" title="bdsim.components.FunctionBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.FunctionBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">MUX</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>nin</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>float,
A(N,)</p></td>
<td><p>A(M,)
A(M,)</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.connections.Mux.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">nin=1</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#Mux.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.Mux.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nin</strong> (<em>int</em><em>, </em><em>optional</em>) – Number of input ports, defaults to 1</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A MUX block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Mux instance</p>
</dd>
</dl>
<p>Create a multiplexer block.</p>
<p>This block takes a number of scalar or vector signals and concatenates
them into a single vector signal.  For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">MUX</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">func1</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">sum3</span><span class="p">)</span>
</pre></div>
</div>
<p>multiplexes the outputs of blocks <code class="docutils literal notranslate"><span class="pre">func1</span></code> (port 2) and <code class="docutils literal notranslate"><span class="pre">sum3</span></code> into
a single output vector.  If the explicit inputs are omitted they can be wired
using the <code class="docutils literal notranslate"><span class="pre">connect</span></code> function.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.connections.OutPort">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.connections.</code><code class="sig-name descname">OutPort</code><span class="sig-paren">(</span><em class="sig-param">nin=1</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#OutPort"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.OutPort" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SubsystemBlock" title="bdsim.components.SubsystemBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SubsystemBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">OUTPORT</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 40%" />
<col style="width: 30%" />
<col style="width: 30%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>nin</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>any</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.connections.OutPort.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">nin=1</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#OutPort.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.OutPort.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nin</strong> (<em>int</em><em>, </em><em>optional</em>) – Number of input ports, defaults to 1</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A OUTPORT block</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>OutPort instance</p>
</dd>
</dl>
<p>Create an output port block for a subsystem.</p>
<p>This block connects a subsystem to a parent block diagram.  Outputs of the
parent-level <code class="docutils literal notranslate"><span class="pre">SubSystem</span></code> block are the inputs of this block.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="bdsim.blocks.connections.SubSystem">
<em class="property">class </em><code class="sig-prename descclassname">bdsim.blocks.connections.</code><code class="sig-name descname">SubSystem</code><span class="sig-paren">(</span><em class="sig-param">subsys</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#SubSystem"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.SubSystem" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="bdsim.html#bdsim.components.SubsystemBlock" title="bdsim.components.SubsystemBlock"><code class="xref py py-class docutils literal notranslate"><span class="pre">bdsim.components.SubsystemBlock</span></code></a></p>
<p><p style="border:10px; background-color:#000000; padding: 1em; color: white; font-size: 30px; font-weight: bold;">SUBSYSTEM</p></p>
<table class="docutils align-left">
<colgroup>
<col style="width: 36%" />
<col style="width: 36%" />
<col style="width: 27%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>inputs</p></td>
<td><p>outputs</p></td>
<td><p>states</p></td>
</tr>
<tr class="row-even"><td><p>ss.in.nout</p></td>
<td><p>ss.out.nin</p></td>
<td><p>0</p></td>
</tr>
<tr class="row-odd"><td><p>any</p></td>
<td><p>any</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="bdsim.blocks.connections.SubSystem.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">subsys</em>, <em class="sig-param">*inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bdsim/blocks/connections.html#SubSystem.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bdsim.blocks.connections.SubSystem.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>subsys</strong> (<em>str</em><em> or </em><a class="reference internal" href="bdsim.html#bdsim.blockdiagram.BlockDiagram" title="bdsim.blockdiagram.BlockDiagram"><em>BlockDiagram</em></a>) – Subsystem as either a filename or a <code class="docutils literal notranslate"><span class="pre">BlockDiagram</span></code> instance</p></li>
<li><p><strong>*inputs</strong> (<a class="reference internal" href="bdsim.html#bdsim.components.Block" title="bdsim.components.Block"><em>Block</em></a><em> or </em><a class="reference internal" href="bdsim.html#bdsim.components.Plug" title="bdsim.components.Plug"><em>Plug</em></a>) – Optional incoming connections</p></li>
<li><p><strong>**kwargs</strong> – common Block options</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>ImportError</strong> – DESCRIPTION</p></li>
<li><p><strong>ValueError</strong> – DESCRIPTION</p></li>
</ul>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SUBSYSTEM block</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>SubSystem instance</p>
</dd>
</dl>
<p>Create a subsystem block.</p>
<p>This block represents a subsystem in a parent block diagram.  It can be
specified as either:</p>
<blockquote>
<div><ul class="simple">
<li><p>the name of a module which is imported and must contain only
only <code class="docutils literal notranslate"><span class="pre">BlockDiagram</span></code> instance, or</p></li>
<li><p>a <code class="docutils literal notranslate"><span class="pre">BlockDiagram</span></code> instance</p></li>
</ul>
</div></blockquote>
<p>The referenced block diagram must contain one or both of:</p>
<blockquote>
<div><ul class="simple">
<li><p>one <code class="docutils literal notranslate"><span class="pre">InPort</span></code> block, which has outputs but no inputs. These
outputs are connected to the inputs to the enclosing <code class="docutils literal notranslate"><span class="pre">SubSystem</span></code> block.</p></li>
<li><p>one <code class="docutils literal notranslate"><span class="pre">OutPort</span></code> block, which has inputs but no outputs. These
inputs are connected to the outputs to the enclosing <code class="docutils literal notranslate"><span class="pre">SubSystem</span></code> block.</p></li>
</ul>
</div></blockquote>
<p>Notes:</p>
<ul class="simple">
<li><p>The referenced block diagram is treated like a macro and copied into 
the parent block diagram at compile time. The <code class="docutils literal notranslate"><span class="pre">SubSystem</span></code>, <code class="docutils literal notranslate"><span class="pre">InPort</span></code> and
<code class="docutils literal notranslate"><span class="pre">OutPort</span></code> blocks are eliminated, that is, all hierarchical structure is 
lost.</p></li>
<li><dl class="simple">
<dt>The same subsystem can be used multiple times, its blocks and wires</dt><dd><p>will be cloned.  Subsystems can also include subsystems.</p>
</dd>
</dl>
</li>
<li><p>The number of input and output ports is not specified, they are computed
from the number of ports on the <code class="docutils literal notranslate"><span class="pre">InPort</span></code> and <code class="docutils literal notranslate"><span class="pre">OutPort</span></code> blocks within the
subsystem.</p></li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-bdsim.blocks.io">
<span id="io-blocks"></span><h2>io blocks<a class="headerlink" href="#module-bdsim.blocks.io" title="Permalink to this headline">¶</a></h2>
<p>Define real-time i/o blocks for use in block diagrams.  These are blocks that:</p>
<ul class="simple">
<li><p>have inputs or outputs</p></li>
<li><p>have no state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">SourceBlock</span></code> or <code class="docutils literal notranslate"><span class="pre">SinkBlock</span></code></p></li>
</ul>
</div>
<div class="section" id="module-bdsim.blocks.vision">
<span id="vision-blocks"></span><h2>Vision blocks<a class="headerlink" href="#module-bdsim.blocks.vision" title="Permalink to this headline">¶</a></h2>
<p>Define vision processing blocks for use in block diagrams.  These are blocks that:</p>
<ul class="simple">
<li><p>have inputs or outputs</p></li>
<li><p>have no state variables</p></li>
<li><p>are a subclass of <code class="docutils literal notranslate"><span class="pre">SourceBlock</span></code>, <code class="docutils literal notranslate"><span class="pre">SinkBlock</span></code> or <code class="docutils literal notranslate"><span class="pre">FunctionBlock</span></code></p></li>
</ul>
</div>
</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">Block diagram simulation</a></h1>








<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Code documentation:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="bdsim.html">bdsim package</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Blocks</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.sources">Source blocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.sinks">Sink blocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.functions">Function blocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.transfers">Transfer blocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.robots">Robot blocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.connections">Connection blocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.io">io blocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-bdsim.blocks.vision">Vision blocks</a></li>
</ul>
</li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="bdsim.html" title="previous chapter">bdsim package</a></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2020, Peter Corke.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="_sources/bdsim.blocks.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>